<?php
declare (strict_types = 1);

namespace app\admin\controller;

use app\common\controller\BaseListController;

class IndexController extends BaseListController
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        return $this->view->fetch();
    }

    public function user()
    {
        return $this->view->fetch();
    }
    
    /**
     * 获取用户数据（模拟数据）
     *
     * @return \think\Response
     */
    public function userdata()
    {
        // 模拟数据
        $data = [
            'code' => 200,
            'msg' => 'success',
            'data' => [
                'total' => 3,
                'list' => [
                    [
                        'id' => 1,
                        'username' => 'admin',
                        'email' => 'admin@example.com',
                        'role' => '管理员',
                        'status' => 1,
                        'create_time' => '2023-01-01 12:00:00',
                        'last_login' => '2023-06-15 08:30:00'
                    ],
                    [
                        'id' => 2,
                        'username' => 'user1',
                        'email' => 'user1@example.com',
                        'role' => '编辑',
                        'status' => 1,
                        'create_time' => '2023-02-15 10:20:00',
                        'last_login' => '2023-06-14 16:45:00'
                    ],
                    [
                        'id' => 3,
                        'username' => 'user2',
                        'email' => 'user2@example.com',
                        'role' => '普通用户',
                        'status' => 0,
                        'create_time' => '2023-03-20 14:30:00',
                        'last_login' => '2023-05-30 09:15:00'
                    ]
                ]
            ]
        ];
        
        return json($data);
    }
}
